Repository navigation
fix(cinder): emit volume inventory once per volume - #159
Open
Jeremy Lee (legit-ninja) wants to merge 1 commit into
Open
Jeremy Lee (legit-ninja) wants to merge 1 commit into
Jeremy Lee (legit-ninja) wants to merge 1 commit into
Conversation
Group attachment rows by volume ID for inventory and status counts. Retain distinct nonempty server IDs in sorted order while preserving GiB capacity and existing labels. Cover duplicate and reordered attachments with pedantic gathering and repeated HTTP exposition alongside Heat metrics. Signed-off-by: David Hulick <dave.hulick@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VolumeGetAllWithAttachmentsreturns one row per volume attachment, so the Cinder volumes collector emitted duplicateopenstack_cinder_volume_gbandopenstack_cinder_volume_statussamples for multi-attached volumes and over-countedopenstack_cinder_volumesand the per-status counts. When duplicate rows carry the same labels, the Prometheus registry can also fail the scrape.This groups attachment rows by volume ID so each volume is emitted once.
Changes
volume_gband onevolume_statussample per volume. Capacity stays in GiB and thesizelabel keeps its raw GiB value.server_idis empty when no server is attached, the server UUID for a single attachment, or a comma-separated, lexically sorted list of distinct server UUIDs for multi-attachment. Empty server IDs are dropped.openstack_cinder_volumesand the status counters count distinct volume IDs.Compatibility
For multi-attached volumes,
server_idnow holds a list, so a query matching one server UUID exactly will not match those volumes. Single-attachment and unattached volumes produce the same series as before.The attachment query excludes soft-deleted attachments but has no attachment status or timestamps, so nondeleted historical attachments still contribute their server IDs.
Tests
No openstackdb changes are needed. Independent of the other exporter PRs; #162 later renames
volume_gbtovolume_bytesand will need its README reconciled with this one.